import { Navigate } from 'react-router-dom';
import { useRoutes } from 'react-router-dom';
import Index from '../page/index/Index';
import Login from '../page/login/Login';
import Home from '../page/home/Home';
import SystemSet from '../page/system/SystemSet';
import VisitorList from '../page/visitor/VisitorList';
import VisitorAdd from '../page/visitor/VisitorAdd';
import VisitorPrincipal from '../page/visitor/VisitorPrincipal';
import DeparmentList from '../page/department/DepartmentList';
import DeparmentAdd from '../page/department/DepartmentAdd';
import AdministratorList from '../page/administrator/AdministratorList';
import AdministratorAdd from '../page/administrator/AdministratorAdd';
import CancelList from '../page/cancel/CancelList';
import CancelAdd from '../page/cancel/CancelAdd';
import CancelLog from '../page/cancel/CancelLog';
import AuditList from '../page/audit/AuditList';
import CampusList from '../page/campus/CampusList';
import CampusAdd from '../page/campus/CampusAdd';
const Routes = () => {
  return useRoutes([
    {
      path: '/',
      element: <Navigate to="/login" replace />,
    },
    {
      title: '登录',
      path: '/login',
      element: <Login />,
    },
    {
      title: '首页',
      path: '/index',
      element: <Index />,
      children: [
        {
          index: true,
          element: <Home />,
        },
        {
          title: '首页',
          path: 'home',
          element: <Home />,
        },
        {
          title: '系统管理',
          path: 'system',
          element: <SystemSet />,
        },
        // 访客
        {
          title: '访客管理',
          path: 'visitor',
          children: [
            {
              title: '访客记录',
              path: 'visitorlist',
              element: <VisitorList />,
            },
            {
              title: '访客增改',
              path: 'visitoradd',
              element: <VisitorAdd />,
            },
            {
              title: '负责人操作',
              path: 'visitorprincipal',
              element: <VisitorPrincipal />,
            },
          ],
        },
        // 部门
        {
          title: '部门管理',
          path: 'deparment',
          children: [
            {
              title: '部门列表',
              path: 'deparmentlist',
              element: <DeparmentList />,
            },
            {
              title: '部门增改',
              path: 'deparmentadd',
              element: <DeparmentAdd />,
            },
          ],
        },
        // 管理员
        {
          title: '管理员管理',
          path: 'administrator',
          children: [
            {
              title: '管理员列表',
              path: 'administratorlist',
              element: <AdministratorList />,
            },
            {
              title: '管理员增改',
              path: 'administratoradd',
              element: <AdministratorAdd />,
            },
          ],
        },
        // 核销人员
        {
          title: '核销管理',
          path: 'cancel',
          children: [
            {
              title: '核销人列表',
              path: 'cancellist',
              element: <CancelList />,
            },
            {
              title: '核销人增改',
              path: 'canceladd',
              element: <CancelAdd />,
            },
            {
              title: '核销人日志',
              path: 'cancellog',
              element: <CancelLog />,
            },
          ],
        },
        // 审核日志
        {
          title: '审核管理',
          path: 'audit',
          children: [
            {
              title: '审核日志',
              path: 'auditlist',
              element: <AuditList />,
            },
          ],
        },
        // 校园动态
        {
          title: '校园管理',
          path: 'campus',
          children: [
            {
              title: '校园动态列表',
              path: 'campuslist',
              element: <CampusList />,
            },
            {
              title: '校园动态增改',
              path: 'campusadd',
              element: <CampusAdd />,
            },
          ],
        },
      ],
    },
  ]);
};
export default Routes;
